﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="<%=app.description %>" />
    <meta name="keywords" content="<%=app.keywords%>" />
    <meta name="viewport" content="<%=app.viewport%>" />
    
    <meta name="apple-mobile-web-app-title" content="<%=app.title%>"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit" />
    
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    
    <title><%=app.title%></title>
		<%
			let p = baseUrl + 'resource/js/';
		%>
		<!--[if lte IE 8]>
			<script type="text/javascript" src="<%= p%>es5-shim.min.js"></script>
			<script type="text/javascript" src="<%= p%>es5-sham.min.js"></script>
			<script type="text/javascript" src="<%= p%>console-polyfill.min.js"></script>
		<![endif]-->
		
		<script type="text/javascript" src="<%= p%>es6-promise.min.js"></script>
		
		<!--[if IE]>
			<script type="text/javascript" src="<%= p%>jquery-1.12.4.min.js"></script>
		<![endif]-->
		
		<!--[if !IE]><!-->
			<script type="text/javascript" src="<%= p%>jquery-2.2.4.min.js"></script>
		<!--<![endif]-->
		<script type="text/javascript" src="<%= p%>react.min.js"></script>
		<script type="text/javascript" src="<%= p%>react-dom.min.js"></script>
		<%
      let js_resoures = [];
      for(let resource of app.resources){
        if(resource.filetype === "icon"){
      %>
        <link rel="icon" type="image/icon" href="<%=resource.main%>">
      <%
        }else if(resource.filetype === "css" && resource.type === 0){%>
				<link rel="stylesheet" href="<%=resource.main%>">
			<%}else if(resource.filetype === "css" && resource.type === 1){%>
				<style type="text/css">
					<!--
						<%- resource.main %>
					-->
				</style>
      <%}else if(resource.filetype === "css" && resource.type === 2){%>
				<link rel="stylesheet" href="<%=CDNLibPath + resource.main%>">
      <%}else if(resource.filetype === "js"){
          js_resoures.push(resource);
        }
      }
    %>
		<style type="text/css">
			<!--
				<%- app.main_css %>
			-->
		</style>
    <script type='text/javascript'>
			var vinculum = {};
      vinculum.config = {
        debug:<%=app.debug || 0%>
        ,appname : "<%=app.name%>"
        ,apptitle:"<%=app.title%>"
        ,appdesc:"<%=app.description%>"
        ,baseUrl:"<%=baseUrl%>"
        ,CDNLibPath:"<%=CDNLibPath%>"
        ,CDNImagePath:"<%=CDNImagePath%>"
        ,CDNMediaPath:"<%=CDNMediaPath%>"
        ,query:<%-query%>
        ,servicePath:"<%=baseUrl%>service/"
        ,actionPath:"<%=baseUrl%>action/"
				,serviceData:<%-serviceData%>
				,actionData:<%-actionData%>
      };
      vinculum.CONST = <%-appConst%>;
    </script>
		<script type="text/javascript" src="<%= p%>vinculum.js"></script>
		<script type="text/javascript" src="<%= p%>theme/components_bootstrap.js"></script>
		<script type="text/javascript" src="<%= p%>theme/components_amazeui.js"></script>
</head>
<body>
    <%-app.main_html || ''%>
		<%
      for(let resource of js_resoures){
				if(resource.type === 0){%>
				<script type="text/javascript" src="<%=resource.main%>"></script>
		<%}else if(resource.type === 1){%>
				<script type="text/javascript">
          <!--
            <%- resource.main %>
          -->
        </script>
		<%}else if(resource.type === 2){%>
			<script type="text/javascript" src="<%=CDNLibPath + resource.main%>"></script>
		<%}}%>
		<script type="text/javascript">
			<!--
				<%-app.main_js || ''%>
			-->
		</script>
</body>
</html>
